package cn.wolfcode.wolf2w.controller;


import cn.wolfcode.wolf2w.domain.Banner;
import cn.wolfcode.wolf2w.service.IBannerService;
import cn.wolfcode.wolf2w.util.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


//首页
@RestController
@RequestMapping("index")
public class IndexController {

    @Autowired
    private IBannerService bannerService;

    //首页推荐游记前五
    @RequestMapping("/banners/travel")
    public Object BannersTravel() {
        List<Banner> travelList = bannerService.getTop5(Banner.TYPE_TRAVEL);
        return JsonResult.success(travelList);
    }


    //首页推荐攻略
    @GetMapping("/banners/strategy")
    public Object Bannerstrategy() {
        List<Banner> banner = bannerService.getTravel(Banner.TYPE_STRATEGY);
        return JsonResult.success(banner.get(0));
    }

}

